package com.example.Login;

import ch.qos.logback.core.util.StringUtil;
import jakarta.servlet.http.HttpSession;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserController {
    @RequestMapping("/login")
    public Boolean login(String userName, String password, HttpSession session) {
        //校验参数
       /* if(userName == null || userName.equals("")) {
            return false;
        }
        if(StringUtils.hasLength(userName) && StringUtils.hasLength(password)) {
            //校验账号密码正确
            //采用硬编码的方式
            //假设账号为：zhangsan，密码为123456
            if("zhangsan".equals(userName) && "123456".equals(password)) {
                return true;
            }
        }
     return false;*/
        if(!StringUtils.hasLength(userName) && !StringUtils.hasLength(password)) {
            return false;
        }
        //验证账号密码正确
        if("zhangsan".equals(userName) && "123456".equals(password)) {
            
        }
    }
}
